<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>day18ActiveSQL</title>
		<script src="../JQuery/jquery-3.6.0.min.js"></script>
		<script>
			function fo_fn_1(){
				$.ajax({
					url:"http://localhost:8080/dept/getByColumns",
					data:$("#14_form_1").serialize(),
					
					success:function(data){
						for (var i = 0; i < data.length; i++) {
							$("#14_h5_"+(i+1)).text(JSON.stringify(data[i]));
						}
						
						console.log("success!!!");
					},
					error:function(data){
						for (var i = 0; i < data.length; i++) {
							$("#14_h5_"+(i+1)).text(JSON.stringify(data[i]));
						}
						console.log("error!!!");
					}
				})
				
			}
			function fo_fn_2(){//getBySeveralId
				$.ajax({
					url:"http://localhost:8080/dept/getBySeveralId",
					data:$("#14_form_2").serialize(),
					
					success:function(data){
						for (var i = 0; i < data.length; i++) {
							$("#14_h5_"+(i+1)).text(JSON.stringify(data[i]));
						}
						
						console.log("success!!!");
					},
					error:function(data){
						for (var i = 0; i < data.length; i++) {
							$("#14_h5_"+(i+1)).text(JSON.stringify(data[i]));
						}
						console.log("error!!!");
					}
				})
				
			}
			
			
			
		</script>
	</head>
	<body>
		<!-- 查询全部 -->
		<a href="http://localhost:8080/dept/getAl">http://localhost:8080/dept/getAl</a>

		<!-- 多个字段模糊查询 -->
		<h5 id="14_h5_1">14_h5_1</h5>
		<h5 id="14_h5_2">14_h5_2</h5>
		<h5 id="14_h5_3">14_h5_3</h5>
		<h5 id="14_h5_4">14_h5_4</h5>
		<h5 id="14_h5_5">14_h5_5</h5>
		<form action="#" method="post" id="14_form_1">
			<table>
				<tr>
					<td>
						id:<input type="text" name="id" />
					</td>
				</tr>
				<tr>
					<td>
						dname:<input type="text" name="dname" />
					</td>
				</tr>
				<tr>
					<td>
						loc:<input type="text" name="loc" />
					</td>
				</tr>
				<tr>
					<td>
						<input type="button" value="显示" onclick="fo_fn_1()" />
					</td>
				</tr>
			</table>
			
		</form>
		
		<!-- 一个字段两个值精确查询 -->
		<form method="post" action="#" id="14_form_2">
		
			<table>
				<tr>
					<td> <input type="text" name="ids" placeholder="请输入第一个id.."/></td>
				</tr>
				<tr>
					<td> <input type="text" name="ids" placeholder="请输入第二个id.." /></td>
				</tr>
				<tr>
					<td> <input type="button" value="点击提交" onclick="fo_fn_2()" /></td>
				</tr>
		
			</table>
		
		
		</form>
		
	</body>
</html>
